package com.lfz.demo.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lfz.demo.repository.ChinaPopulationRepository;
import com.lfz.demo.dao.IndexMapper;
import com.lfz.demo.entity.ChinaPopulation;
import com.lfz.demo.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lfz
 * @date 2025/2/24 18:11
 */
@Service
public class IndexServiceImpl extends ServiceImpl<IndexMapper, ChinaPopulation> implements IndexService {

    @Autowired
    private IndexMapper indexMapper;

    @Autowired
    private ChinaPopulationRepository chinaPopulationRepository;

    @Override
    public Page<ChinaPopulation> findByPage(Specification<ChinaPopulation> spec, Pageable pageable) {
        return chinaPopulationRepository.findAll(spec, pageable);
    }

    @Override
    public List<ChinaPopulation> findChinaPopulation() {
        List<ChinaPopulation> list = indexMapper.findChinaPopulation();
        return list;
    }

    @Override
    public List<ChinaPopulation> findByCensusTime(String censusTime) {
        List<ChinaPopulation> list = indexMapper.findByCensusTime(censusTime);
        return list;
    }

}
